import { configureStore } from "@reduxjs/toolkit";

import cart from './modules/cart'
import setting from './modules/setting'
import storage from 'redux-persist/lib/storage'

import {persistReducer,persistStore} from 'redux-persist'

let persist_carts={
    key:"carts",
    storage
}

let persist_settings={
    key:"setting",
    storage
}

let persist_cart=persistReducer(persist_carts,cart)
let persist_setting=persistReducer(persist_settings,setting)

export let store=configureStore({
    reducer:{
        cart:persist_cart,
        setting:persist_setting
    },
    middleware:(getDefaultMiddleware)=>getDefaultMiddleware({
        serializableCheck:false
    })
})

export let persistor=persistStore(store)